<?php
namespace Common\Controller;
use Think\Controller;
/**
 * cms项目公共Action
 */
class HomebaseController extends Controller 
{
    protected $lang;
    protected $status;
    public function _initialize() 
    {
        $url=$_SERVER['REQUEST_URI'];
        $urlArr= explode('/', $url);
        $isLang = strtolower($urlArr[1]);
        $this->lang=($isLang=='en')?"en":"zh";
        $this->assign('lang',$this->lang);
        $this->status = array('gt',0);
    }

    //获取表单令牌
    protected function getToken() {
        $tokenName = C('TOKEN_NAME');
        // 标识当前页面唯一性
        $tokenKey = md5($_SERVER['REQUEST_URI']);
        $tokenAray = session($tokenName);
        //获取令牌
        $tokenValue = $tokenAray[$tokenKey];
        return $tokenKey . '_' . $tokenValue;
    }
     
}
?>
